package com.rainner.app.base.action;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Results;

import com.opensymphony.xwork2.ActionSupport;
import com.rainner.app.model.JsonResult;

@ParentPackage("json")
@Results({@org.apache.struts2.convention.annotation.Result(type="json", name="MAP", params={"root", "map"}), @org.apache.struts2.convention.annotation.Result(type="json", name="ARRAY", params={"root", "array"}), @org.apache.struts2.convention.annotation.Result(type="json", name="OBJECT", params={"root", "object"})})
public class JsonAction extends ActionSupport
{
  private static final long serialVersionUID = -8158865407882024475L;
  public static final String MAP = "MAP";
  public static final String ARRAY = "ARRAY";
  public static final String OBJECT = "OBJECT";
  public Map<String, Object> map = new HashMap<String, Object>();
  @SuppressWarnings("rawtypes")
public List array = new ArrayList();
  public Object object = new Object();
  public JsonResult result = new JsonResult();

  public void setResult(boolean state, String msg)
  {
    this.result.setState(state);
    this.result.setMsg(msg);
    this.map.put("result", this.result);
  }


  public Map<String, Object> getMap() {
	return map;
}


public void setMap(Map<String, Object> map) {
	this.map = map;
}


public List getArray() {
	return array;
}


public void setArray(List array) {
	this.array = array;
}


public Object getObject() {
    return this.object;
  }

  public void setObject(Object object) {
    this.object = object;
  }

  public JsonResult getResult() {
    return this.result;
  }

  public void setResult(JsonResult result) {
    this.result = result;
  }
}